<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
		<title>实名认证-确认基本信息</title>
		<link rel="stylesheet" href="../../css/mui.min.css">
		<link rel="stylesheet" href="../../css/app.css">
		<style>
			body{background: #f3f3f3;overflow: auto;}
			.mui-bar {width: 7.5rem;position: relative !important;}
			.inform{width: 100%;height: 0.28rem;color:#f31c1c;font-size: 0.28rem;margin-top: 0.35rem;padding-left: 0.26rem;}
			.inform div{float: left;height: 0.28rem;line-height: 0.28rem;}
			.inform div:first-child{font-size: 0.6rem;line-height: 0.55rem;}
			.mui-table-view{width: 100%;margin-top: 0.3rem;}
			.mui-table-view:after,.mui-table-view:before{display: none;}
			.mui-table-view-cell:after{background:#f3f3f3 ;}
			.mui-table-view-cell{font-size: 0.30rem;height: 0.92rem;padding: 0.22rem 0.3rem;}
			.mui-table-view-cell input{height: 100%;font-size: 0.28rem;position:absolute;right:0;top:0;width: 4.4rem;padding:0 !important;margin: 0 !important;border: none !important;}
			.next{width: 6rem;height: 0.68rem;/*background: #a0a0a0;*/font-size: 0.3rem;color: #fff;border: none;outline: none;border-radius: 0.1rem;margin-top: 0.9rem;}
			.text{margin-top: 3.15rem;color: #999999;font-size: 0.28rem;}
			.img_box{width: 100%;height: 0.54rem;margin-top: 0.55rem;padding-left: 1.3rem;margin-bottom: 0.1rem;}
			.img_box img{width: 0.5rem;margin-right: 1.1rem;}
			.img_box img:last-child{margin-right: 0;}
			.img_info{width: 100%;padding-left: 1rem;}
			.img_info div{float: left;font-size: 0.28rem;color: #adadad;}
			.img_info div:first-child{margin-right: .6rem;}
			.img_info div:nth-child(2){margin-right: .6rem;}
		</style>
	</head>
	<body>
		<!--<div class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<a class="back">返回</a>
			<h1 class="mui-title">实名认证</h1>
		</div>-->
		<div class="inform"><div>*</div><div>请填写您的真实信息(信息一经验证，将不可修改)</div></div>
		<ul class="mui-table-view">
		    <li class="mui-table-view-cell">
		    	姓名
		    	<input type="text" id="name" placeholder="请填写" />
		    </li>
		    <li class="mui-table-view-cell">
		    	身份证号码
		    	<input type="text" id="idCard" placeholder="请填写" />
		    </li>
		</ul>
		<button class="next mui-btn mui-btn-primary">下一步</button>
		<div class="text">实名认证优势</div>
		<div class="img_box">
			<img src="../../images/work/sb.png"/>
			<img src="../../images/work/zx.png"/>
			<img src="../../images/work/js.png"/>
		</div>
		<div class="img_info">
			<div>网上申报</div>
			<div>咨询投诉</div>
			<div>生活缴费</div>
		</div>
	</body>
	<script>
		function my_immersed(immersed){
			
		}
	</script>
	<script src="../../js/immersed.js"></script>
	<script src="../../js/mui.min.js"></script>
	<script src="../../js/common.js"></script>
	<script src="../../js/app.js" ></script>
	<script>
		/*document.getElementById("name").addEventListener('input',function(){
			console.log(this.value);
		});*/
		var verifyType = null;//认证方式(上一步认证方式)
		mui.plusReady(function(){
			verifyType=utils.getUrlParam('verifyType');
		})
		document.querySelector('.next').addEventListener('tap',function(){
			var name = document.getElementById('name').value;
			var idCard = document.getElementById('idCard').value;
			var user = getUser();
			if (!user) {
				mui.toast('当前登录用户信息不正确');
				return;
			}
			if (user.idVerifyStatus.indexOf('3') >= 0) {
				mui.toast('已验证，无需再次验证');
				return;
			}
			if (!name) {
				mui.toast('请填写真实姓名！');
				return;
			}
			if (!isIDCard(idCard)) {
				mui.toast('请填写有效身份证！');
				return;
			}
			var idVerifyType = 3;
			var params = {"realName":name,"idCard":idCard,"userId":user.userId,"idVerifyType":idVerifyType};
			utils.ajax('appHttpService/verify.do',function(data){
				var data = JSON.parse(data);
				if (data.state == '1') {//验证成功
					user.userName = name;
					user.idCard = idCard;
					user.idVerifyStatus = user.idVerifyStatus + "|3";
					setState(user);
					//mui.toast('身份证实名认证成功');
					if (verifyType) {
						switch(verifyType) {
							case 'tel':
								showTemplates('tel_rz.html','手机号实名认证','_www/src/login/tel_rz.html');
								plus.webview.currentWebview().hide();
								plus.webview.currentWebview().close();
								break;
							case 'yhk':
								showTemplates('yhk_rz.html','银联卡实名认证','_www/src/login/yhk_rz.html');
								plus.webview.currentWebview().hide();
								plus.webview.currentWebview().close();
								break;
							default:
								mui.back();
						}
					} else {
						mui.back();
					}
				} else {//验证失败
					mui.toast(data.msg);
				}
			},jsonToParams(params),null,function(){
				mui.toast('抱歉，当前服务不可用，请稍后再试');
			})
		})
	</script>
</html>